<?php
class otherController extends accessController{
    public static function _right(){
        return array(
            array('网站管理',1),
            array('更新common.js','update_js,update_js_'),
            array('程序助手','help,help2,help3'),
            array('示例程序','example'),
            array('文件查看','file_detail'),
        );
    }
	public function index(){
		
	}
	public function s(){
		return array('other');
	}
	//更新common.js
	public function update_js(){
		$content=file_get_contents(ROOT.'common/static/js/common.js');
		
		include($this->viewer_dir.'other/update_js.php');
	}
	public function update_js_(){
		if($_POST){
			$file=ROOT.'common/static/js/common_example.js';
			$file2=ROOT.'common/static/js/common.js';
			if(file_exists($file)){
				$r=$this->s_0->update_js_($file,$file2);
				autoalert($r);
				back();
			}else{
				alert('common_example.js文件不存在！');
				back();
			}
			
		}
	}
    public function help(){
        $fields=array();
        include($this->viewer_dir.'other/help.php');
    }
    public function help2(){
        $table=trim($_POST['table']);
        if($table){
            $fields=$this->s_0->help_($table);
            $comments=$this->s_0->_comment($table);
            include($this->viewer_dir.'other/help2.php');
        }
    }
    public function help3(){
        if($_POST){
            $return=(array) $this->s_0->help2_($_POST);
            $notnull=(array) $return['_choosed_notnull'];
            $fields=(array) $return['_choosed_fields'];
            $types=(array) $return['_choosed_types'];
            $names=(array) $return['_choosed_names'];
            $diys=(array) $return['_choosed_diys'];
            $lengths=(array) $return['_choosed_lengths'];
            include($this->viewer_dir.'other/help3.php');
        }
    }
    public function example(){
        include($this->viewer_dir.'other/example.php');
    }
    public function file_detail(){
        $detail=$this->s_0->file_detail(array('controllers','lang','models','rules','services'));
        include($this->viewer_dir.'other/file_detail.php');
    }
//
}